<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Class和Style绑定</title>
  <style>
    .red{
        color: red;
    }
    .yellow{
        color: yellow;
    }
    .big-font{
        font-size: 33px;
    }
  </style>
</head>
<body>
<div id="app">
  <p :class="className">CSS 绑定</p>
  <p :class="{'red': isRed, 'big-font': isBigFont}">CSS 绑定</p>
  <p :class="styleObj">CSS 绑定</p>
  <p :class="computedObj">CSS 绑定</p>
  <p :class="[redClass,bigFont]">CSS 绑定</p>
</div>

<script src="../vue.global.js"></script>
<script>
  const App = {
    data(){
      return {
        className: 'red',
        isRed: true,
        isBigFont: true,
        styleObj: {
          'yellow': true,
          'big-font': true,
        },
        redClass: 'red',
        bigFont: 'big-font',

      }
    },
    computed: {
      computedObj(){
        return {
          'red': true,
          'big-font': true,
        }
      }
    }
  }

  const vm = Vue.createApp(App).mount('#app');
  console.log(vm)
</script>
</body>
</html>
